<!--!
This file is a part of MediaDrop (https://www.mediadrop.video),
Copyright 2009-2018 MediaDrop contributors
For the exact contribution history, see the git revision log.
The source code contained in this file is licensed under the GPLv3 or
(at your option) any later version.
See LICENSE.txt in the main project directory, for more information.
-->

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:i18n="http://genshi.edgewall.org/i18n"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      py:strip=""
      py:with="download_uris = show_download and sorted((uri for uri in (h.download_uri(file) for file in media.files) if uri), key=lambda uri: uri.file.size);
               embed_code = show_embed and h.embed_iframe(media);
               show_like = settings['appearance_show_like'] and show_like;
               show_dislike = settings['appearance_show_dislike'] and show_dislike;
               show_popout = settings['appearance_show_popout'] and show_popout;
               show_resize = settings['appearance_show_widescreen'] and show_resize;
               show_share = settings['appearance_show_share'] and show_share;
               show_embed = settings['appearance_show_embed'] and show_embed and embed_code;
               show_download = settings['appearance_show_download'] and show_download and download_uris;
               show_playerbar = show_playerbar and (show_like or show_dislike or show_popout or show_resize or show_share or show_embed or show_download);">

	<xi:include py:for="tmpl in value_of('plugin_templates', ())" href="${tmpl}" />

	<div py:if="player" id="${player.elem_id}-wrapper" class="mcore-player">
		<div class="mcore-playerbox">
			${player.render_markup()}
		</div>
		<div py:if="show_playerbar" class="mcore-playerbar">
			<ul class="mcore-nav">
				<py:choose test="settings.get('likes')">
					<py:when test="'facebook'">
						<xi:include href="../comments/facebook.html" />
						<li class="mcore-nav-left">
							<a class="mcore-nav-link"><span class="mcore-btn-fb-like">${facebook_like(h.url_for_media(media, qualified=True), width=90)}</span><em /></a><span class="mcore-nav-link-sep" />
						</li>
					</py:when>
					<py:otherwise>
						<li py:if="show_like" class="mcore-nav-left">
					        <span class="mcore-nav-link mcore-like mcore-cursor-pointer">
					            <span>
						            <form action="${h.url_for(controller='/media', action='rate', slug=media.slug)}" method="POST">
						                <input name="up" value="1" type="hidden" />
						                <input type="submit" value="" title="${_('Like')}" class="mcore-btn-like mcore-btn-img" />
						            </form>
						            <span class="mcore-navbar-text">${_('Like')}</span>
					            </span>
						        <em />
					        </span>
					        <span class="mcore-nav-link-sep" py:if="not show_dislike" />
						</li>
						
						<li py:if="show_dislike" class="${not show_like and 'mcore-nav-left' or None}">
					        <span class="mcore-nav-link mcore-dislike mcore-cursor-pointer">
					            <span>
						            <form action="${h.url_for(controller='/media', action='rate', slug=media.slug)}" method="POST">
						                <input name="down" value="1" type="hidden" />
						                <input type="submit" value="" title="${_('Dislike')}" class="mcore-btn-dislike mcore-btn-img" />
						            </form>
					            </span>
						        <em />
					        </span>
					        <span class="mcore-nav-link-sep" /></li>
						<li py:if="not show_like and not show_dislike" class="mcore-nav-left"><span class="mcore-nav-link"><span></span></span></li>
					</py:otherwise>
				</py:choose>
				<li py:if="show_popout" class="f-rgt mcore-nav-right"><a class="mcore-nav-link mcore-popout" href="${h.url_for(controller='/media', action='embed_player', slug=media.slug)}" title="Pop out a new player window"><span><span class="mcore-btn-popout">Pop Out</span></span><em /></a></li>
				<li py:if="show_resize" class="f-rgt ${not show_popout and 'mcore-nav-right' or None}"><a class="mcore-nav-link mcore-resizer" href="#" title="${is_widescreen and _('Shrink') or _('Expand')}"><span><span class="mcore-btn-${is_widescreen and 'shrink' or 'expand'}">${is_widescreen and _('Shrink') or _('Expand')}</span></span><em /></a></li>
				<li py:if="show_share" class="f-rgt ${not (show_popout or show_resize) and 'mcore-nav-right' or None}">
					<a class="mcore-nav-link" href="#" title="Share"><span>Share</span><em /></a>
					<div id="sharethis-hover" class="meta-hover" py:with="current_url = h.url_for_media(media, qualified=True)">
						<div class="meta-hover-top"></div>
						<div class="meta-hover-content">
							<label>Permalink: <input type="text" value="${current_url}" readonly="readonly" /></label>
						</div>
						<ul class="meta-hover-bottom">
							<li class="share-email"><a title="Share by email" href="mailto:?subject=${media.title}&amp;body=${current_url}">Share by Email</a></li>
							<li class="share-facebook"><a title="Share on Facebook" href="http://www.facebook.com/sharer/sharer.php?u=${current_url}">Share on Facebook</a></li>
							<li class="share-twitter"><a title="Share on Twitter" href="http://twitter.com/home?status=${media.title + ': ' + current_url}">Share on Twitter</a></li>
						</ul>
					</div>
				</li>
				<li py:if="show_embed" class="f-rgt ${not (show_popout or show_resize or show_share) and 'mcore-nav-right' or None}">
					<a class="mcore-nav-link" href="#" title="Embed"><span>Embed</span><em /></a>
					<div id="embedthis-hover" class="meta-hover">
						<div class="meta-hover-top"></div>
						<div class="meta-hover-content">
							<label>Embeddable Player HTML: <input type="text" value="${unicode(embed_code)}" readonly="readonly" /></label>
						</div>
						<div class="meta-hover-bottom"></div>
					</div>
				</li>
				<li py:if="show_download" class="f-rgt ${not (show_popout or show_resize or show_share or show_embed) and 'mcore-nav-right' or None}">
					<a class="mcore-nav-link" href="${download_uris[0]}" title="Download"><span>Download</span><em /></a>
					<div py:if="len(download_uris) > 1" class="meta-hover">
						<div class="meta-hover-top"></div>
						<div class="meta-hover-content">
							<ul>
								<li py:for="uri in download_uris">
									<a href="${uri}" class="underline-hover">${uri.file.display_name}</a>
								</li>
							</ul>
						</div>
						<div class="meta-hover-bottom"></div>
					</div>
				</li>
			</ul>
		</div>
	</div>

	<script type="text/javascript" py:if="player">
		mcore.initPlayerController('${player.elem_id}-wrapper', ${player.render_js_player() or 'null'}, ${js_init or 'undefined'});
	</script>

</html>
